// Copyright 2006 Two Pair, LLC. All Rights Reserved.

/**
 * Represents the user-specified options.
 */
public class UserSettings {

  /**
   * Constructs a user settings object with the specified settings.
   * 
   * @param fileName the file the user specifed; may be <code>null</code>
   * @param cAnalyzer a character analyzer based on the user options
   * @param wAnalyzer a word analyzer based on the user options
   * @param threshold the user-specified threshold
   * @param phraseLength the user-specified length of a phrase
   */
  public UserSettings(String fileName, CharacterAnalyzer cAnalyzer,
      WordAnalyzer wAnalyzer, int threshold, int phraseLength) {
    this.fileName = fileName;
    this.cAnalyzer = cAnalyzer;
    this.wAnalyzer = wAnalyzer;
    this.threshold = threshold;
    this.phraseLength = phraseLength;
  }

  /**
   * @return a character analyzer representing the user's options
   */
  public CharacterAnalyzer getCharacterAnalyzer() {
    return cAnalyzer;
  }

  /**
   * @return a word analyzer representing the user's options
   */
  public WordAnalyzer getWordAnalyzer() {
    return wAnalyzer;
  }

  /**
   * @return the file the user specifed, or <code>null</code> if the user did
   *         not specify a file
   */
  public String getFileName() {
    return fileName;
  }

  /**
   * @return the user-specified frequency with which a phrase must occur to be
   *         printed; greater than or equal to 1
   */
  public int getThreshold() {
    return threshold;
  }

  /**
   * @return the user-specified length of a phrase; between 1 and 9 inclusive
   */
  public int getPhraseLength() {
    return phraseLength;
  }

  /**
   * A character analyzer representing the user's options.
   */
  private final CharacterAnalyzer cAnalyzer;

  /**
   * The input file the user specifed, or <code>null</code> if the user did
   * not specify a file.
   */
  private final String fileName;

  /**
   * The length of a phrase, specified by the user.
   */
  private final int phraseLength;

  /**
   * The frequency with which a phrase must occur to be printed, specified by
   * the user.
   */
  private final int threshold;

  /**
   * A word analyzer representing the user's options.
   */
  private final WordAnalyzer wAnalyzer;

}
